package cn.ad.param;

import org.springframework.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 素材审核列表 查询参数
 * 
 * @author yujuan.zhang
 * @from 2016-07-29
 * @since DSP V1.1
 *
 */
public class MaterialAuditQuery extends AbstractPagingSortParam {
	
	/***
	 * 广告形式
	 */
	private Integer adFormat;
	
	/**
	 * 搜索关键词， 创意ID或者创意名称
	 */
	private String search;
	
	public Integer getAdFormat() {
		return adFormat;
	}

	public void setAdFormat(Integer adFormat) {
		this.adFormat = adFormat;
	}

	public String getSearch() {
		return search;
	}

	public void setSearch(String search) {
		this.search = search;
	}

	/**
	 * 默认按id排序
	 */
	@Override
	public String getSortby() {
		return StringUtils.isEmpty(super.getSortby()) ? "id" : super.getSortby();
	}

	/**
	 * 默认按降序排序
	 */
	@Override
	public ORDER getOrder() {
		return super.getOrder() == null ? ORDER.desc : super.getOrder();
	}
	
	public Map<String, Object> getSearchMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("key", this.search);
		map.put("adFormat", this.adFormat);
		map.put("sortby", this.getSortby());
		map.put("order", this.getOrder());
		return map;
	}

}
